ProjectName.modules.Category = {
    init: function () {
        this.formValidation();
        this.generateAlias();
    } ,
    
    //###
    generateAlias: function () {
        /*Code to generate seo friendly url */
            jQuery('#title').blur(function(){
            var categoryName =  jQuery('#title').val();
            categoryName = categoryName.replace(/[^\w\s]/gi, '');
            categoryName = categoryName.toLowerCase();
            seoCategoryName = categoryName.replace(/[\s]/gi, '-');
            jQuery('#alias').val(seoCategoryName);
        });

    }, 
    
    formValidation : function () {
        var container = $('div.pageerrorcontainer-validator');
        $("#categoryfrm").validate({
            errorContainer: container,
            errorLabelContainer: $("div.error-iterator", container),
            wrapper: 'div',
            rules: {
                title: {
                    required: true
                },
                //###
                alias : {
                	required: true
			 },
                status: {
                    required: true
                }
            },
            messages: {
                title: {
                    required: "Please enter title."
                },
                //###
                alias: {
                    required: "Please enter seo friendly alias."
                },
                status: {
                    required: "Please select status."
                }
            }
        });
    }
}

